package cn.hjm.hrm.feign.client;

import cn.hjm.hrm.domain.Order;
import cn.hjm.hrm.dto.ProductDto;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;

@Component
public class OrderFeignFallBack implements FallbackFactory<OrderFeginClient> {

    //降级方法
    @Override
    public OrderFeginClient create(Throwable throwable) {
        return new OrderFeginClient() {
            @Override
            public Order createorder(ProductDto productDto) {
                return new Order(-1L,null,new BigDecimal(0),new BigDecimal(0),-1L,-1L,null);
            }
        };
    }
}
